package service.impl;

import dao.WorkDao;
import domain.Resume;
import domain.Work;
import service.WorkService;
import util.MyBatisUtil;

import java.util.List;

public final class WorkServiceImpl implements WorkService {
    private WorkServiceImpl() {}
    private static final WorkServiceImpl INSTANCE = new WorkServiceImpl();
    private static final WorkDao workDao = MyBatisUtil.getMapper(WorkDao.class);
    public static WorkServiceImpl getINSTANCE() { return INSTANCE; }

    @Override
    public int addWork(Work work) {
        return workDao.insert(work);
    }

    @Override
    public int resetWork(Work work) {
        return workDao.update(work);
    }

    @Override
    public Work selectById(Long id) {
        return workDao.selectById(id);
    }

    @Override
    public List<Work> selectByRecruiterId(Long recruiterId) {
        return workDao.selectByRecruiterId(recruiterId);
    }

    @Override
    public List<Work> selectByPassState(int passState) {
        return workDao.selectByPassState(passState);
    }

    @Override
    public List<Work> selectAll() {
        return workDao.selectAll();
    }

    @Override
    public List<Work> selectByName(String name) {
        return workDao.selectByName(name);
    }

    @Override
    public List<Work> selectByPlace(String place) {
        return workDao.selectByPlace(place);
    }

    @Override
    public List<Work> selectByInformation(String information) {
        return workDao.selectByInformation(information);
    }

    @Override
    public int onWork(Work work) {
        work.setPassState(1);
        return workDao.update(work);
    }
}
